package com.stylefeng.guns.modular.biz.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.common.persistence.dao.ActMapper;
import com.stylefeng.guns.common.persistence.model.Activity;
import com.stylefeng.guns.modular.biz.service.ActService;
import com.stylefeng.guns.modular.system.dao.ActDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@Service
public class ActServiceImpl implements ActService {

    @Resource
    private ActMapper actMapper;
    @Resource
    private ActDao actDao;
    @Override
    public List<Activity> selectActs(Map<String, Object> params) {
        EntityWrapper ew=new EntityWrapper();
        ew.setEntity(params);
        ew.orderBy("ac_year",false);
        return actMapper.selectList(ew);
    }

    @Override
    public void insert(Activity activity) {
        actMapper.insert(activity);
    }

    @Override
    public Activity selectActById(Integer acid) {
        return actMapper.selectById(acid);
    }

    @Override
    public void update(Activity activity) {
        actMapper.updateById(activity);
    }

    @Override
    public List<Activity> selectActList(Map<String, Object> params) {
        return actDao.selectActivities(params);
    }
}
